#include <head.h>

void *Func(void * arg)
{
    int *val = (int *)arg;
    printf("我是一个线程\n");
    *val = 80;
    return (void *)val;
}


int main(int argc, char const *argv[])
{
    pthread_t tid = 0;
    int num = 0;
    pthread_create(&tid,NULL ,Func ,(void *)&num);

    void * retu;
    //让主线程或 进程等待线程完成后进行释放
    pthread_join(tid,&retu);
    int *val = retu;
    printf("val = %d\n",*val);
    printf("num = %d\n",num);

    pthread_detach(tid);

    sleep(1);    
    
    return 0;
}